
class compare(object):

    def __init__(self, current_dict, past_dict):
        self.current_dict, self.past_dict = current_dict, past_dict
        self.set_current, self.set_past = set(current_dict.keys()), set(past_dict.keys())
        self.intersect = self.set_current.intersection(self.set_past)
        self.path = ""
        self.dict_diff={}

    def added(self):
        return self.set_current - self.intersect
    def removed(self):
        return self.set_past - self.intersect


    def print_diff(self):

        self.changed(self.current_dict, self.past_dict)
        for key, value in self.dict_diff.iteritems():
            key=str(key).replace("_", "/")
            print "At this key '%s' : '%s' is different than '%s' \n " % (key, value[0], value[1])


    def changed(self, current_dict, past_dict):

        for key, value in current_dict.iteritems():

            if isinstance(value, dict):
                if key in past_dict:
                    if isinstance(past_dict[key], dict):

                        self.path = "%s_%s" % (self.path, key)
                        self.changed(value, past_dict[key])
            else:
                if key in past_dict:
                    if current_dict[key] != past_dict[key]:
                        self.dict_diff[self.path] = (current_dict[key], past_dict[key])
        return